import { useState } from 'react';
import PropTypes from 'prop-types'; //vite-plugin-eslint 里面
function Btn({ count, onClick }) {
  return (
    <div>
      <button onClick={onClick}> 点击+1</button>
      {count}
    </div>
  );
}
Btn.propTypes = {
  count: PropTypes.number,
  onClick: PropTypes.func,
};
function App() {
  let [count, setCount] = useState(0);
  let handleClick = () => {
    setCount(count + 1);
  };
  return (
    <div>
      hello App
      <Btn count={count} onClick={handleClick}></Btn>
      <Btn count={count} onClick={handleClick}></Btn>
    </div>
  );
}

export default App;
